import React from 'react';

class ClassFun extends React.Component {
    constructor(props) {
        super(props)
        console.log(props)
    }
    state = {
        name: 'qiao',
        age: 19
    }
    render() {
        let { name, age } = this.state;
        return (<div>
            <h1>我叫：{name}</h1><br />
            <h1>我{age}岁</h1>
            <button
                onClick={(e) => {
                    this.setState(function () {
                        return {
                            age: ++age
                        }
                    });
                }}
            >长一岁</button>
        </div >);
    }
}

export default ClassFun;